import request from '@/utils/request.js'

// 获取商家配送模式  {{host}}shop/shop_shipments/getShopShipments
/**
 * @param shop_id
*/
export const GetShopShipmentsApi = (params) => {
	return request('/shop/shop_shipments/getShopShipments', params)
}

// 商品下单预览  {{host}}shop/order/confirm_order_page 请求该接口返回展示参数
/**
 * @param sku_details 可以是多个数组
 * @param sku_detailsValue :{ "note": "", "goods_item_id": 1295, //规格ID "num": 2, //数量 "goods_name": "" //商品名称 }
 * @param shipments 	配送方式
 * @param longitude
 * @param latitude
*/
export const GetOrderViewApi = (params) => {
	return request('/shop/order/confirm_order_page', params)
}

// 执行下单操作  {{host}}shop/order/confirm_order
/**
 * @param sku_details 可以是多个数组
 * @param sku_detailsValue :{ "note": "", "goods_item_id": 1295, //规格ID "num": 2, //数量 "goods_name": "" //商品名称 }
 * @param shipments 	配送方式
 * @param longitude
 * @param latitude
 * @param pick_time   预约提货时间 shipments == 2的时候必填 
*/
export const SubmitOrderApi = (params) => {
	return request('/shop/order/confirm_order', params)
}

// 立即购买  {{host}}/payment/pay/pay
/**
 * @param target_type orderall 固定值不变
 * @param target shop/order/confirm_order 接口中返回的trade_sn
 * @param pay 	配送方式
 * @param payValue :{ "pay_type": "deposit", //deposit=余额支付 wechat=微信支付 miniapp = 微信小程序支付 "money": 215 //支付金额 }
*/
export const PaymentApi = (params) => {
	return request('/payment/pay/pay', params)
}

// 获取订单列表 {{host}}/shop/transport/order_list
/**
 * @param page
 * @param page_size
 * @param status 0待付款 1已付款 2配送中 3已完成
*/
export const GetOrderListApi = (params) => {
	return request('/shop/transport/order_list', params)
}

// 获取订单详情 {{host}}/shop/transport/order_detail
/**
 * @param order_id
*/
export const GetOrderDetailsApi = (params) => {
	return request('/shop/transport/order_detail', params)
}

// 删除订单 {{host}}/shop/order/order_del
/**
 * @param order_id
*/
export const DelOrderApi = (params) => {
	return request('/shop/order/order_del', params)
}

// 确认收货 {{host}}/shop/transport/take_delivery
/**
 * @param order_id
*/
export const ConfirmOrderApi = (params) => {
	return request('/shop/transport/take_delivery', params)
}
// 确认提货 {{host}}/shop/transport/take_delivery_2
/**
 * @param order_id
*/
export const ConfirmOrderTHApi = (params) => {
	return request('/shop/transport/take_delivery_2', params)
}

// 评价商品 {{host}}/shop/order/order_comment
/**
 * @param order_id
 * @param shop [{ star: '', rider_star: '', img: '', sku: '', is_ni: ''}]
 * @param shop.star 评分星级
 * @param shop.rider_star 骑手评分 当shipments ==1 时有该字段 其他情况下不传该参数
 * @param shop.detail 评价内容
 * @param shop.img 图片如果是多个 用逗号拼接
 * @param shop.sku 商品SKU
 * @param shop.is_ni 1匿名 0不匿名
*/
export const EvaGoodsApi = (params) => {
	return request('/shop/order/order_comment', params)
}

// 查看物流 {{host}}/shop/Transport/invoice_look
/**
 * @param order_id
*/
export const ViewExpressApi = (params) => {
	return request('/shop/Transport/invoice_look', params)
}

// 取消订单 {{host}}/shop/Transport/cancel_order
/**
 * @param order_id
*/
export const CancelOrderApi = (params) => {
	return request('/shop/Transport/cancel_order', params)
}

// 评价商家 {{host}}/shop/order/order_comment_shop
/**
 * @param order_id
 * @param shop [{ star: '', img: '', shop_id: '', is_ni: ''}]
 * @param shop.star 评分星级
 * @param shop.detail 评价内容
 * @param shop.img 图片如果是多个 用逗号拼接
 * @param shop.shop_id 商品SKU
 * @param shop.is_ni 1匿名 0不匿名
*/
export const EvaShopApi = (params) => {
	return request('/shop/order/order_comment_shop', params)
}

// 申请退款 {{host}}/shop/Transport/refund_apply
/**
 * @param order_id
 * @param refund_cause 退款原因
*/
export const RefundApplyApi = (params) => {
	return request('/shop/Transport/refund_apply', params)
}
